package org.example.backend.demos.web.api;

import org.example.backend.demos.web.common.Result;
import org.example.backend.demos.web.volunteerModule.controller.ApplyResult;
import org.example.backend.demos.web.volunteerModule.controller.BatchAuditDTO;
import org.example.backend.demos.web.volunteerModule.controller.PageResult;
import org.example.backend.demos.web.volunteerModule.entity.AuditDTO;
import org.example.backend.demos.web.volunteerModule.entity.Volunteer;
import org.example.backend.demos.web.volunteerModule.entity.VolunteerDTO;
import org.example.backend.demos.web.volunteerModule.entity.VolunteerQuery;
import org.example.backend.demos.web.volunteerModule.service.VolunteerStats;
import org.example.backend.demos.web.volunteerModule.service.impl.BatchAuditResult;
import org.springframework.web.bind.annotation.*;

/**
 * 志愿者报名API接口
 * 路径：/api/volunteer
 */
@RequestMapping("/api/volunteer")
public interface VolunteerApi {

    // ==================== 志愿者功能 ====================

    /**
     * 提交志愿者申请
     * POST /api/volunteer/apply
     */
    @PostMapping("/apply")
    Result<ApplyResult> submitApplication(@RequestBody VolunteerDTO volunteerDTO,
                                          @RequestHeader("Authorization") String authHeader);

    /**
     * 获取我的报名记录
     * GET /api/volunteer/my-applications?page=1&size=10&status=0
     */
    @GetMapping("/my-applications")
    Result<PageResult<Volunteer>> getMyApplications(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size,
            @RequestParam(required = false) Integer status,
            @RequestHeader("Authorization") String authHeader);

    /**
     * 获取报名详情
     * GET /api/volunteer/applications/{id}
     */
    @GetMapping("/applications/{id}")
    Result<Volunteer> getApplicationDetail(@PathVariable Long id,
                                           @RequestHeader("Authorization") String authHeader);

    // ==================== 管理员功能 ====================

    /**
     * 管理员获取报名列表
     * GET /api/volunteer/admin/applications?page=1&size=10&status=0
     */
    @GetMapping("/admin/applications")
    Result<PageResult<Volunteer>> getAdminApplicationList(VolunteerQuery query,
                                                          @RequestHeader("Authorization") String authHeader);

    /**
     * 管理员审核志愿者申请
     * POST /api/volunteer/admin/applications/{id}/audit
     */
    @PostMapping("/admin/applications/{id}/audit")
    Result<Void> auditApplication(@PathVariable Long id,
                                  @RequestBody AuditDTO auditDTO,
                                  @RequestHeader("Authorization") String authHeader);

    /**
     * 管理员批量审核
     * POST /api/volunteer/admin/applications/batch-audit
     */
    @PostMapping("/admin/applications/batch-audit")
    Result<BatchAuditResult> batchAuditApplications(@RequestBody BatchAuditDTO batchAuditDTO,
                                                    @RequestHeader("Authorization") String authHeader);

    /**
     * 管理员获取报名统计
     * GET /api/volunteer/admin/stats
     */
    @GetMapping("/admin/stats")
    Result<VolunteerStats> getVolunteerStats(@RequestHeader("Authorization") String authHeader);
}